import { FormSchema } from '/@/components/BasicForm/type/form';

export const moduleSchemas: FormSchema = [
  {
    field: 'name',
    label: '模块名称',
    component: 'Input',
    componentProps: {
      placeHolder: '请输入模块名称',
    },
    labelWidth: 100,
    colProps: { span: 24 },
    required: true,
  },
  {
    field: 'protocol',
    label: '协议',
    component: 'Select',
    componentProps: {
      placeHolder: '请选择端口号',
      options: [
        {
          label: 'http',
          value: 'http',
        },
        {
          label: 'https',
          value: 'https',
        },
      ],
    },
    labelWidth: 100,
    colProps: { span: 24 },
    required: true,
  },
  {
    field: 'port',
    label: '端口号',
    component: 'Input',
    rules: [
      {
        trigger: 'change',
        required: true,
        message: '请输入端口号',
      },
      {
        trigger: 'change',
        pattern: /^((6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])|[0-5]?\d{0,4})$/g,
        message: '请输入正确的端口号',
      },
    ],
    componentProps: {
      placeHolder: '请输入端口号',
    },
    labelWidth: 100,
    colProps: { span: 24 },
    required: true,
  },
];
